import request from '@/utils/request'

import {
  loginFormData,
  loginResponseData,
  userinfoResData,
  ResponseData,
} from './types'
// https://github.com/huccct/vue-admin/blob/main/src/api/user/type.ts

enum API {
  LOGIN_URL = '/admin/acl/index/login',
  USERINFO_URL = '/admin/acl/index/info',
  LOGOUT_URL = '/admin/acl/index/logout',
}

// 登录接口
export const reqLogin = (data: loginFormData) =>
  request.post<loginFormData, loginResponseData>(API.LOGIN_URL, data)

// 获取用户信息接口
export const reqUserInfo = () =>
  request.get<any, userinfoResData>(API.USERINFO_URL)

// 退出登录
export const reqLogut = () => request.post<any, ResponseData>(API.LOGOUT_URL)
